package com.ruoyi.huanjing.entity.dto;

import com.ruoyi.huanjing.entity.DistancePulseData;

/**
 * 距离-脉冲数据DTO
 */
public class DistancePulseDTO {
    private double[] rangeGates; // 距离门
    private double[] pulses;     // 脉冲数
    private double[][] realPart; // 实部数据
    private double[][] imagPart; // 虚部数据

    // 从实体类构建DTO
    public static DistancePulseDTO fromEntity(DistancePulseData entity) {
        DistancePulseDTO dto = new DistancePulseDTO();
        if (entity == null) {
            dto.setRangeGates(new double[0]);
            dto.setPulses(new double[0]);
            dto.setRealPart(new double[0][0]);
            dto.setImagPart(new double[0][0]);
            return dto;
        }

        dto.setRangeGates(entity.getRangeGates() != null ? entity.getRangeGates() : new double[0]);
        dto.setPulses(entity.getPulses() != null ? entity.getPulses() : new double[0]);
        dto.setRealPart(entity.getRealPart() != null ? entity.getRealPart() : new double[0][0]);
        dto.setImagPart(entity.getImagPart() != null ? entity.getImagPart() : new double[0][0]);
        return dto;
    }

    // Getter & Setter
    public double[] getRangeGates() {
        return rangeGates;
    }

    public void setRangeGates(double[] rangeGates) {
        this.rangeGates = rangeGates;
    }

    public double[] getPulses() {
        return pulses;
    }

    public void setPulses(double[] pulses) {
        this.pulses = pulses;
    }

    public double[][] getRealPart() {
        return realPart;
    }

    public void setRealPart(double[][] realPart) {
        this.realPart = realPart;
    }

    public double[][] getImagPart() {
        return imagPart;
    }

    public void setImagPart(double[][] imagPart) {
        this.imagPart = imagPart;
    }
}